import Vue from 'vue'
import Vuex from 'vuex'
import user from "./user";
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import fa from "element-ui/src/locale/lang/fa";

Vue.use(mavonEditor)
Vue.use(Vuex)

new Vue({
  'el': '#main',
  data() {
    return { value: '' }
  }
})

export default new Vuex.Store({
  state: {
    isLogin: user.getters.getUser(user.state())!==null,
    searchInput:"",
    isAdmin: user.getters.getUser(user.state())===null ? false:user.getters.getUser(user.state()).user.userIsAdmin,
    isBan:user.getters.getUser(user.state())===null ? false:user.getters.getUser(user.state()).user.userIsBan
  },
  getters: {
    getIsLogin(state){
      return state.isLogin
    },
    getSearchInput(state){
      return state.searchInput
    }
  },
  mutations: {
    changeInput(state,string){
      state.searchInput=string
    }
  },
  actions: {
    clear({ commit }) {
      commit("$_removeStorage");
    }
  },
  modules: {
    user
  }
})
